<?php

    new Themater_AboutUs();
    
    class Themater_AboutUs
    {
        var $theme;
        
        var $defaults = array(
            'enabled' => 'true',
            'hook' => 'aboutus',
            'title' => 'Welcome to our website. Neque porro quisquam est qui dolorem ipsum dolor.',
            'content' => 'Lorem ipsum eu usu assum liberavisse, ut munere praesent complectitur mea. Sit an option maiorum principes. Ne per probo magna idque, est veniam exerci appareat no. Sit at amet propriae intellegebat, natum iusto forensibus duo ut. Pro hinc aperiri fabulas ut, probo tractatos euripidis an vis, ignota oblique.'
        );
        
        function Themater_AboutUs()
        {
            global $theme;
            $this->theme = $theme;
            
            if(is_array($this->theme->options['plugins_options']['aboutus']) ) {
                $this->defaults = array_merge($this->defaults, $this->theme->options['plugins_options']['aboutus']);
            }
            
            if($this->theme->display('aboutus_enabled') ) { 
                $this->theme->add_hook($this->defaults['hook'], array(&$this, 'display_aboutus'));
            }
            
  
            if(is_admin()) {
                $this->aboutus_options();
            }
        }

        
        function display_aboutus()
        {
            if(is_home()) {
                ?><div class="aboutusbox">
                
                <?php 
                
                if($this->theme->display('aboutus_title')) {
                    echo '<h2 class="aboutusbox-title">' . $this->theme->get_option('aboutus_title') . '</h2>';
                }
                
                if($this->theme->display('aboutus_content')) {
                    echo '<div class="aboutusbox-content">' . $this->theme->get_option('aboutus_content') . '</div>';
                }
                ?></div><?php
            }
        }
        
        function aboutus_options()
        {
            $this->theme->admin_option(array('About Us', 14), 
                '"About Us" section enabled?', 'aboutus_enabled', 
                'checkbox', $this->defaults['enabled'], 
                array('display'=>'inline')
            );
            
            $this->theme->admin_option('About Us', 
                'Title', 'aboutus_title', 
                'text', $this->defaults['title']
            );
            
            $this->theme->admin_option('About Us', 
                'Content', 'aboutus_content', 
                'textarea', $this->defaults['content'],
                array('style'=>'height: 250px;')
            );
        }
    }
?>